{
  "properties" : { },
  "id" : "dd24a67f1a554b8592a601482cdabfeb",
  "script" : null,
  "groupId" : "3645e1b8d51d45b2962afccf83364267",
  "name" : "删除指定文件",
  "createTime" : null,
  "updateTime" : 1668098748980,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/deleteFile",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": -1,\n    \"message\": \"系统内部出现错误\",\n    \"data\": null,\n    \"timestamp\": 1668098012201,\n    \"executeTime\": 4694\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "-1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "系统内部出现错误",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "null",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1668098012201",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "4694",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import log;
import response;
//读取上传文件根目录
import '@/evn/fileRootPath' as fileRootPath;
//调用java
import com.neusoft.weekreport.component.FileUtil.deleteFile;
//导入java.io.File包
import java.io.File;
//多选删除
if (body.select == true) {
    for (item in body.path) {
        File file = new File(item.get("filePath"))
        if (file == null || !file.isFile()) {
            System.out.println("删除失败,请检查文件是否存在");
            return false;
        }
        file.delete();
        System.out.println(item.get(fileName)+"文件删除成功!");
    }
} else {
    //单选删除
    //2.获取删除的绝对路径
    File dir = new File(body.path);
    //3.调用Java删除文件接口类
    if (deleteFile.deleteFileOnly(dir)) {
        System.out.println("文件删除成功!");
    } else {
        return response.json({
            success: false,
            message: '删除失败,请检查目录是否存在',
            code: 0
        });
    }
}